var playDlg = null;
var DDSBResArray = [];
var YPXXGLResArray = [];
var YPXXSHResArray = [];
var resYAPPArray = [];
var ZjkResArray=[];
var YjwzResArray = [];
var ZskResArray = [];
//mark的图层
var ddsbmarklayer;
//防灾预案点是新增点还是已知点  0:已有点  1：新增点
var isNewForFzya = 0;
///////////////////////////////////////预案匹配结果管理////////////////////////////////////////////////////////////
//初始化查询列表
function initYapp_fzjcTable(){
	$("#yapp_tableFZJC").datagrid({
		url:"",
		striped : true,
		pageSize : 10,
		height : 315,
		nowrap : false,
		columns : [[ {
					field : '1_jbqk0110',
					title : '灾害点名称',
					width : 120,
					align : 'center',
					editor : 'text'
				},{
					field : '1_jbqk0102',
					title : '灾害点标识',
					width : 70,
					align : 'center',
					formatter : function(value, rec, rowIndex) {// value id rec
						// 该对象
						//curRecObj = rec;
						var type="";
						if(rec[1].id==null){
							type = top.getOperTypeZhdByCode(rec[1].jbqk0102);
						}else{
							type = top.getOperTypeZhdByCode(rec[1].id.jbqk0102);
						}
						
						var resutsHTML = "<div style='align:center;'>"
								+type
								+"</div>";
						return resutsHTML;
					}
				},	{
					field : '0_fzya03170',
					title : '地理位置',
					width : 100,
					align : 'center',
					editor : 'text'
				},{
					field : '0_fzya03190',
					title : '规模',
					width : 50,
					align : 'center',
					editor : 'text'
				},{
					field : '0_fzya03200',
					title : '威胁人口',
					width : 60,
					align : 'center',
					editor : 'text'
				},{
					field : '0_fzya03210',
					title : '威胁财产',
					width : 60,
					align : 'center',
					editor : 'text'
				},{
					field : '0_fzya03220',
					title : '险情等级',
					width : 60,
					align : 'center',
					editor : 'text'
				},{
					field : '0_fzya03280',
					title : '潜在危害',
					width : 120,
					align : 'center',
					editor : 'text'
				},{
					field : 'oper',
					title : '操作',
					width : 120,
					align : 'center',
					formatter : function(value, rec, rowIndex) {// value id rec
						// 该对象
						//curRecObj = rec;
						resYAPPArray.push(rec);
						var num = resYAPPArray.length-1;
						var resutsHTML = "";
						var resutsHTML = "<div style='align:center;'>"
								+ "<a name='showDetails' style='padding:5px;cursor:pointer;text-decoration: underline;' onclick='showYAPPDetails(\""
								+ num
								+ "\",false)'>详情</a>"
								+ "<a name='addLink' style='padding:5px;cursor:pointer;text-decoration: underline;' onclick='showYAPPDetails(\""
								+ num
								+ "\",true)'>修改</a>"
								+ "<a name='addLink' style='padding:5px;cursor:pointer;text-decoration: underline;' onclick='exportYAPPDetails(\""
								+ num
								+ "\")'>导出</a>"
								+"</div>";
						return resutsHTML;
					}
				}]],
		pagination : true,
		rownumbers : true,
		singleSelect : true,
		onClickRow : function(rowIndex) {
		},
	});
}


//点击预案匹配的查询按钮的方法
function queryYapp_Fzjc(){
	var region =$("#YAPPShen").val();
	if($("#YAPPXian").val()!="-1"){
		region = $("#YAPPXian").val();
	}else if($("#YAPPShi").val()!="-1"){
		region = $("#YAPPShi").val();
	}
	var zhlx = $("#YAPPZHLX").val();
	var gm = $("#YAPPGM").val();
	var xqdj = $("#YAPPZQDJ").val();
	var wxrk = $("#YAPPWXRK").val();
	var wxcc = $("#YAPPWXCC").val();
	var qType =  $("input[name='qType']:checked").val();
	var data = {
		"region":region,
		"zhlx" :zhlx,
		"gm" :gm,
		"xqdj" :xqdj,
		"wxrk" :wxrk,
		"wxcc" :wxcc,
		"qType":qType
	}
	debugger;
	var url = "queryFzyaList.shtml";
	$('#yapp_tableFZJC').datagrid({
				url : url,
				queryParams : data,
				onLoadSuccess : function(res) {
					isNewForFzya = res.jsonResult;
					//$("#region").attr("value",res.selects[0]);
				},
				onLoadError : function(res) {
					alert("查询失败!");
				}
			});
}

//////////////////////////////////////////应急物资////////////////////////////////////////////////////////////
function changeYJZYCXLX(value){
	switch (value){
		case "专家库信息":
			$("#yjwzQueryDiv").attr("style","display:none");
			$("#zjkQueryDiv").attr("style","display:display");
			$("#zjk_table").datagrid('resize');
			break;
		case "应急物资信息":
			$("#zjkQueryDiv").attr("style","display:none");
			$("#yjwzQueryDiv").attr("style","display:display");
			$("#yjwz_table").datagrid('resize');
			break;
	}
}

function initYjzyZjkTable(){
	$("#zjk_table").datagrid({
		url:"",
		striped : true,
		pageSize : 10,
		height : 315,
		nowrap : false,
		columns : [[ {
					field : 'yjcz06010',
					title : '专家编号',
					width : 180,
					align : 'center',
					editor : 'text'
				},{
					field : 'yjcz06055',
					title : '专家姓名',
					width : 60,
					align : 'center',
					editor : 'text'
				},{
					field : 'yjcz06060',
					title : '工作单位',
					width : 120,
					align : 'center',
					editor : 'text'
				},{
					field : 'yjcz06070',
					title : '职称',
					width : 80,
					align : 'center',
					editor : 'text'
				},{
					field : 'yjcz06100',
					title : '联系电话',
					width : 100,
					align : 'center',
					editor : 'text'
				},{
					field : 'yjcz06130',
					title : '电子邮箱',
					width : 120,
					align : 'center',
					editor : 'text'
				},{
					field : 'oper',
					title : '操作',
					width : 40,
					align : 'center',
					formatter : function(value, rec, rowIndex) {// value id rec
						// 该对象
						//curRecObj = rec;
						ZjkResArray.push(rec);
						var num = ZjkResArray.length-1;
						var resutsHTML = "";
						var resutsHTML = "<div style='align:center;'>"
								+ "<a name='showDetails' style='padding:5px;cursor:pointer;text-decoration: underline;' onclick='showZjkDetails(\""
								+ num
								+ "\",false)'>详情</a>"
								+"</div>";
						return resutsHTML;
					}
				}]],
		pagination : true,
		rownumbers : true,
		singleSelect : true,
		onClickRow : function(rowIndex) {
		},
	});
}

function queryZjk_Yjzy(){
	var name = $("#zjkZJXM").val();
	var data = {
		"name":name
	}
	ZjkResArray = [];
	var url = "queryZjkForYjzy.shtml";
	$("#zjk_table").datagrid({
		url : url,
		queryParams : data,
		onLoadError : function(res) {
			alert("查询失败!");
		},
		onLoadSuccess : function(res) {
		}
	});
}

function showZjkDetails(num){
	var obj = ZjkResArray[num];
	$("#yjcz06010").attr("value",obj.yjcz06010).attr("readOnly","readOnly");
	$("#yjcz06055").attr("value",obj.yjcz06055).attr("readOnly","readOnly");
	$("#yjcz06060").attr("value",obj.yjcz06060).attr("readOnly","readOnly");
	$("#yjcz06070").attr("value",obj.yjcz06070).attr("readOnly","readOnly");
	$("#yjcz06080").attr("value",obj.yjcz06080).attr("readOnly","readOnly");
	$("#yjcz06040").attr("value",obj.yjcz06040).attr("readOnly","readOnly");
	$("#yjcz06050").attr("value",obj.yjcz06050).attr("readOnly","readOnly");
	$("#yjcz06100").attr("value",obj.yjcz06100).attr("readOnly","readOnly");
	$("#yjcz06120").attr("value",obj.yjcz06120).attr("readOnly","readOnly");
	$("#yjcz06130").attr("value",obj.yjcz06130).attr("readOnly","readOnly");
	$("#yjcz06140").attr("value",obj.yjcz06140).attr("readOnly","readOnly");
	$("#yjcz06150").attr("value",obj.yjcz06150).attr("readOnly","readOnly");
	$("#yjcz06160").attr("value",obj.yjcz06160).attr("readOnly","readOnly");
	$("#yjcz06180").attr("value",obj.yjcz06180).attr("readOnly","readOnly");
	$("#yjcz06190").attr("value",obj.yjcz06190).attr("readOnly","readOnly");
	$("#yjcz06200").attr("value",obj.yjcz06200).attr("readOnly","readOnly");
	$("#yjcz06210").attr("value",obj.yjcz06210).attr("readOnly","readOnly");
	$("#yjcz06220").attr("value",obj.yjcz06220).attr("readOnly","readOnly");
	$("#yjcz06230").attr("value",obj.yjcz06230).attr("readOnly","readOnly");
	$("#yjcz06280").attr("value",obj.yjcz06280).attr("readOnly","readOnly");
	$("#yjcz06290").attr("value",obj.yjcz06290).attr("readOnly","readOnly");
	$("#yjcz06310").attr("value",obj.yjcz06310).attr("readOnly","readOnly");
	$("#yjcz06350").attr("value",obj.yjcz06350).attr("readOnly","readOnly");
	$("#detailsDialog_zjk").dialog("open");
}

function initYjzyYjwzTable(){
	$("#yjwz_table").datagrid({
		url:"",
		striped : true,
		pageSize : 10,
		height : 315,
		nowrap : false,
		columns : [[ {
					field : '1_areaName',
					title : '资源所在区域',
					width : 80,
					align : 'center',
					editor : 'text'
				},{
					field : '0_yjzy01020',
					title : '资源所属单位',
					width : 120,
					align : 'center',
					editor : 'text'
				},{
					field : '0_yjzy01030',
					title : '资源类型',
					width : 60,
					align : 'center',
					editor : 'text',
					formatter : function(value, rec, rowIndex) {// value id rec
						// 该对象
						//curRecObj = rec;
						var lx = "";
						if(rec[0].yjzy01030==1){
							lx="人员";
						}
						if(rec[0].yjzy01030==2){
							lx="车辆";
						}
						if(rec[0].yjzy01030==3){
							lx="设备";
						}
						if(rec[0].yjzy01030==4){
							lx="卫星资源";
						}
						var resutsHTML = "";
						var resutsHTML = "<div style='align:center;'>"
								+ lx
								+"</div>";
						return resutsHTML;
				}
				},{
					field : '0_yjzy01040',
					title : '资源名称',
					width : 60,
					align : 'center',
					editor : 'text'
				},{
					field : '0_yjzy01060',
					title : '资源状态',
					width : 60,
					align : 'center',
					editor : 'text',
					formatter : function(value, rec, rowIndex) {// value id rec
					var objArr = top.infoArr;
						var zt = "";
						if(rec[0].yjzy01060==0){
							zt="损坏";
						}
						if(rec[0].yjzy01060==1){
							zt="正常";
						}
						var resutsHTML = "";
						var resutsHTML = "<div style='align:center;'>"
								+ zt
								+"</div>";
						return resutsHTML;
					}
				},{
					field : '0_yjzy01070',
					title : '资源负责人',
					width : 60,
					align : 'center',
					editor : 'text'
				},{
					field : '0_yjzy01080',
					title : '资源负责人联系方式',
					width : 135,
					align : 'center',
					editor : 'text'
				},{
					field : '0_yjzy01090',
					title : '资源使用状态',
					width : 80,
					align : 'center',
					editor : 'text',
					formatter : function(value, rec, rowIndex) {// value id rec
						var zt = "";
						if(rec[0].yjzy01060==0){
							zt="未使用";
						}
						if(rec[0].yjzy01060==1){
							zt="使用中";
						}
						var resutsHTML = "";
						var resutsHTML = "<div style='align:center;'>"
								+ zt
								+"</div>";
						return resutsHTML;
					}
				}/*,{
					field : 'oper',
					title : '操作',
					width : 40,
					align : 'center',
					formatter : function(value, rec, rowIndex) { value id rec						 该对象						curRecObj = rec;						YjwzResArray.push(rec);
						var num = YjwzResArray.length-1;
						var resutsHTML = "";
						var resutsHTML = "<div style='align:center;'>"
								+ "<a name='showDetails' style='padding:5px;cursor:pointer;text-decoration: underline;' onclick='showYjwzDetails(\""
								+ num
								+ "\",false)'>详情</a>"
								+"</div>";
						return resutsHTML;
					}
				}*/]],
		pagination : true,
		rownumbers : true,
		singleSelect : true,
		onClickRow : function(rowIndex) {
		},
	});
}

function queryYjwz_Yjzy(){
	var sheng = $("#yjwzShen").val();
	var shi = $("#yjwzShi").val();
	var xian = $("#yjwzXian").val();
	var areaCode = handlerAreaFunc(shen,shi,xian);
	areaCode = handlerZhCodeFunc(areaCode).substring(0,6);
	var zylx = $("#yjwzZYLX").val();
	var zyzt = $("#yjwzZYZT").val();
	var data = {
		"areaCode":areaCode,
		"zylx":zylx,
		"zyzt":zyzt,
	}
	var url ="queryYjwzForYjzy.shtml";
	YjwzResArray = [];
	$("#yjwz_table").datagrid({
		url : url,
		queryParams : data,
		onLoadError : function(res) {
			alert("查询失败!");
		},
		onLoadSuccess : function(res) {
		}
	});
}

function showYjwzDetails(num){
	var obj = YjwzResArray[num];
	var zt = "";
	if(obj.yjzy01060==1){
		zt="使用";
	}
	if(obj.yjzy01060==2){
		zt="未使用";
	}
	if(obj.yjzy01060==3){
		zt="不能使用";
	}
	var lx = "";
	if(obj.yjzy01030==1){
		lx="人员";
	}
	if(obj.yjzy01030==2){
		lx="车辆";
	}
	if(obj.yjzy01030==3){
		lx="设备";
	}
	if(obj.yjzy01030==4){
		lx="卫星资源";
	}
	$("#yjzy01010").attr("value",obj.yjzy01010).attr("readOnly","readOnly");
	$("#yjzy01020").attr("value",obj.yjzy01020).attr("readOnly","readOnly");
	$("#yjzy01030").attr("value",lx).attr("readOnly","readOnly");
	$("#yjzy01040").attr("value",obj.yjzy01040).attr("readOnly","readOnly");
	$("#yjzy01050").attr("value",obj.yjzy01050).attr("readOnly","readOnly");
	$("#yjzy01060").attr("value",zt).attr("readOnly","readOnly");
	$("#yjzy01070").attr("value",obj.yjzy01070).attr("readOnly","readOnly");
	$("#yjzy01080").attr("value",obj.yjzy01080).attr("readOnly","readOnly");
	$("#yjzy01090").attr("value",obj.yjzy01090).attr("readOnly","readOnly");
	$("#yjzy01100").attr("value",obj.yjzy01100).attr("readOnly","readOnly");
	$("#yjzy01110").attr("value",obj.yjzy01110).attr("readOnly","readOnly");
	$("#yjzy01120").attr("value",obj.yjzy01120).attr("readOnly","readOnly");
	$("#yjzy01130").attr("value",obj.yjzy01130).attr("readOnly","readOnly");
	$("#yjzy01140").attr("value",obj.yjzy01140).attr("readOnly","readOnly");
	$("#detailsDialog_yjwz").dialog("open");
}
///////////////////////////////研判信息////////////////////////////////////////////////
function YPXXGLChange(value){
	
						
						
	switch(value){
	case "YPXXSB":
		$("#YPXXGL").attr("style","display:none");
		$("#YPXXSH").attr("style","display:none");
		$("#YPXXSB").attr("style","display:display");
		$("#ypxxsb_tableFZJC").datagrid('resize');
		break;
	case "YPXXGL":
		$("#YPXXSB").attr("style","display:none");
		$("#YPXXSH").attr("style","display:none");
		$("#YPXXGL").attr("style","display:display");
		$("#ypxxgl_tableFZJC").datagrid('resize');
		break;
	case "YPXXSH":
		$("#ypxxsh_tableFZJC").datagrid('resize');
		$("#YPXXSB").attr("style","display:none");
		$("#YPXXGL").attr("style","display:none");
		//执行一遍查询，查找所有未审核的研判信息
		queryYPXXByStateFlase();
		$("#YPXXSH").attr("style","display:display");
		break;
	}
}

function initYpxxSbTable(){
	$("#ypxxsb_tableFZJC").datagrid({
		url:"",
		striped : true,
		pageSize : 10,
		height : 315,
		nowrap : false,
		columns : [[{
					field : 'yjcz12010',
					title : '上报时间',
					width : 160,
					align : 'center',
					editor : 'text'
				},{
					field : 'yjcz12020',
					title : '地理位置',
					width : 100,
					align : 'center',
					editor : 'text'
				},{
					field : 'yjcz12060',
					title : '上报记录',
					width : 150,
					align : 'center',
					editor : 'text'
				},{
					field : 'yjcz12080',
					title : '多媒体记录',
					width : 240,
					align : 'center',
					editor : 'text',
					formatter : function(value, rec, rowIndex) {// value id rec
						// 该对象
						//curRecObj = rec;
						var num = DDSBResArray.length;
						var resutsHTML = "";
						var resutsHTML = "<div style='align:center;'>"
								+ "<a name='showDetails' style='padding:5px;cursor:pointer;text-decoration: underline;' onclick='bofangDDSBFile(\""
								+ num
								+ "\",false)'>"+rec.yjcz12080+"</a>"
								+"</div>";
						return resutsHTML;
					}
				},{
					field : 'oper',
					title : '操作',
					width : 100,
					align : 'center',
					formatter : function(value, rec, rowIndex) {// value id rec
						// 该对象
						//curRecObj = rec;
						DDSBResArray.push(rec);
						var num = DDSBResArray.length-1;
						var resutsHTML = "";
						var resutsHTML = "<div style='align:center;'>"
								+ "<a  style='padding:5px;cursor:pointer;text-decoration: underline;' onclick='upSBFADlg(\""
								+ num
								+ "\")'>研判填写</a>"
								+"</div>";
						return resutsHTML;
					}
				}]],
		pagination : true,
		rownumbers : true,
		singleSelect : true,
	});
}

//查询单点上报数据表
function queryDDSB_Fzjc(){
	var sheng = $("#ypxxsbShen").val();
	var shi = $("#ypxxsbShi").val();
	var xian = $("#ypxxsbXian").val();
	var zhlx = $("#ypxxsbZHLX").val();
	var areaCode = handlerAreaFunc(shen,shi,xian);
	var zhCode = "";
	if(zhlx==""){
		zhCode = handlerZhCodeFunc(areaCode);
	}else{
		zhCode = handlerZhCodeFunc(areaCode,zhlx);
	}
	var startTime = $("#ypxxsbStartTime").val();
	var endTime = $("#ypxxsbEndTime").val();
	var url = "queryDDSB.shtml";
	var data = {
		"startTime":startTime,
		"endTime":endTime,
		"zhCode":zhCode
	};
	DDSBResArray = [];
	removeLayerAndFeatureForYPXXSB();
	$("#ypxxsb_tableFZJC").datagrid({
		url : url,
		queryParams : data,
		onLoadError : function(res) {
			alert("查询失败!");
		},
		onLoadSuccess : function(res) {
			addMarkForDDSB();
		}
	});
}

//播放单点上报的多媒体功能
function bofangDDSBFile(num){
	var fileName = DDSBResArray[num].yjcz12080;
	var htmlStr = '<audio controls="controls" style="width:250px">'+
					'<source src="uploadfolder/mp3folder/'+fileName+'" type="audio/mpeg">'+
					'</audio>';
	if(playDlg!=null){
		playDlg.close();
	}
	playDlg =  $.dialog({
		title: '播放音频',
		content: htmlStr,
		dlgDivId: "playDlgId",
		resize: false,
		max: false,
		padding:'0px',
		width:'250px',
		left:'0px',
		top:'300px',
		height:'10px',
		close:function (){
			playDlg = null;
		}
	});
}

function addMarkForDDSB(){
	if(ddsbmarklayer!=null){
		top.map.removeLayer(ddsbmarklayer);
	}
	ddsbmarklayer = new OpenLayers.Layer.Markers("ddsbmarklayer");
	top.map.addLayer(ddsbmarklayer);
	for(var i =0;i<DDSBResArray.length;i++){
		var mark = createDdsbMark(DDSBResArray[i]);
		mark.index= i;
		ddsbmarklayer.addMarker(mark);
	}
}

function createDdsbMark(data){
	var size = new OpenLayers.Size(30, 30);
	var icon = new OpenLayers.Icon('image/marker.png', size);
	var mark = new OpenLayers.Marker(new OpenLayers.LonLat(data.yjcz12030,data.yjcz12040),icon);
	return mark;
}

//弹出上报内容对话框
function upSBFADlg(index){
	var num = DDSBResArray[index].yjcz12000;
	addYPNR.obj = DDSBResArray[index];
	$("#TYBHForYPNR").attr("value",num).attr("readOnly","readOnly");
	$("#YPNRText").attr("value","");
	$("#writeYPNR").dialog("open");
}

//弹出审核内容对话框
function upSHYJDlg(index){
	addSHNR.obj = YPXXSHResArray[index];
	var num = YPXXSHResArray[index].ypxx01000;
	var nr = YPXXSHResArray[index].ypxx01040;
	var sbsj = YPXXSHResArray[index].ypxx01010;
	$("#SBNRText").attr("value",nr).attr("readOnly","readOnly");
	$("#SBSJForYPNR").attr("value",sbsj).attr("readOnly","readOnly");
	$("#TYBHForSHNR").attr("value",num).attr("readOnly","readOnly");
	$("#SHNRText").attr("value","");
	$("#writeSHNR").dialog("open");
}


//拿到填写的上报内容，给数据库赋值
function addYPNR(){

	var obj = addYPNR.obj;
	//编号
	var bh = $("#TYBHForYPNR").val();
	//研判内容
	var ypnr = $("#YPNRText").val();
	if(ypnr==""){
		alert("上报内容不能为空！");
		return ;
	}
	//上报人员，单位，时间
	var url = "insertYpnrForYpxx.shtml";
	var dataObj = {
		"ypxx01000":bh,
		"ypxx01040":ypnr,
		"ypxx01110":obj.yjcz12090,
		"jbqk0102":obj.jbqk0102
	}
	var data = JSON.stringify(dataObj);
	$.post(url,{"ypxx01":data}, ypnrSaveResult);
}

function ypnrSaveResult(res){
	if(res.length>4){
		 	//内容的转化（内容有标签时），防止谷歌和火狐抽风之举
 		var hiddenDiv = $("<div>");
 		hiddenDiv.html(res);
 		res = hiddenDiv.text();
		}
	if(res=="true"){
		alert("上报成功！");
	}else{
		alert("上传失败！");
	}
	$("#writeYPNR").dialog("close");
	$("#ypxxsb_tableFZJC").datagrid("reload");
}

//拿到填写的审核意见，给数据库赋值
function addSHNR(){
	var obj = addSHNR.obj;
	var shnr = $("#SHNRText").val();
	var addYjdcsjFlag = $("#addYjdcsjFlag").attr("checked")+"";
	var addYjjcsjFlag = $("#addYjjcsjFlag").attr("checked")+"";
	var addYjhssjFlag = $("#addYjhssjFlag").attr("checked")+"";
	var ypxx01010Time = obj.ypxx01010.replace("T"," ");
	var dataObj = {
		"id":obj.id,
		"ypxx01000":obj.ypxx01000,
		"ypxx01010":obj.ypxx01010.replace("T"," "),
		"ypxx01020":obj.ypxx01020,
		"ypxx01030":obj.ypxx01030,
		"ypxx01040":obj.ypxx01040,
		"ypxx01050":"1",
		"ypxx01090":shnr,
		"ypxx01110":obj.ypxx01110,
		"jbqk0102":obj.jbqk0102
	}
	var url = "insertShnrForYpxx.shtml?ypxx01010Time="+ypxx01010Time+"&addYjdcsjFlag="+addYjdcsjFlag+"&addYjjcsjFlag="+addYjjcsjFlag+"&addYjhssjFlag="+addYjhssjFlag;
	var data = JSON.stringify(dataObj);
	//alert(data);
	$.post(url,{"ypxx01":data}, shnrSaveResult);
	
}

function shnrSaveResult(res){
	if(res.length>4){
	 	//内容的转化（内容有标签时），防止谷歌和火狐抽风之举
		var hiddenDiv = $("<div>");
		hiddenDiv.html(res);
		res = hiddenDiv.text();
	}
	if(res=="true"){
		alert("审核成功！");
	}else{
		alert("审核失败！");
	}
	$("#writeSHNR").dialog("close");
	$("#ypxxsh_tableFZJC").datagrid("reload");
}

//重置上报的内容
function resetYPNREvent(){
	$("#YPNRText").val("");
}

//重置审核的呢绒
function resetSHNREvent(){
	$("#SHNRText").val("");
}

//查询所有未审核的研判信息内容
function queryYPXXByStateFlase(){
	var url = "queryYpxxForYpsh.shtml";
	$("#ypxxsh_tableFZJC").datagrid({
		url : url,
		queryParams : null,
		onLoadError : function(res) {
			alert("查询失败!");
		},
		onLoadSuccess : function(res) {
		}
	});
}

//根据条件查询研判信息，研判信息的管理模块
function queryYpxx_Fzjc(){
	var sheng = $("#ypxxglShen").val();
	var shi = $("#ypxxglShi").val();
	var xian = $("#ypxxglXian").val();
	var zhlx = $("#ypxxglZHLX").val();
	var areaCode = handlerAreaFunc(shen,shi,xian);
	var zhCode = "";
	if(zhlx==""){
		zhCode = handlerZhCodeFunc(areaCode);
	}else{
		zhCode = handlerZhCodeFunc(areaCode,zhlx);
	}
	var sbTimeStart = $("#YPXXSBTimeStart").val();
	var sbTimeEnd = $("#YPXXSBTimeEnd").val();
	var shTimeStart = $("#YPXXSHTimeStrat").val();
	var shTimeEnd = $("#YPXXSHTimeEnd").val();
	var url = "queryYpxxForYpgl.shtml";
	var data = {
		"zhCode":zhCode,
		"sbTimeStart":sbTimeStart,
		"sbTimeEnd":sbTimeEnd,
		"shTimeStart":shTimeStart,
		"shTimeEnd":shTimeStart,
	};
	YPXXGLResArray = [];
	$("#ypxxgl_tableFZJC").datagrid({
		url : url,
		queryParams : data,
		onLoadError : function(res) {
			alert("查询失败!");
		},
		onLoadSuccess : function(res) {
		}
	});
}

function showYPXXDetails(num,flag){
	$("#detailsDialog_ypxxgl").dialog("close");
	var obj = YPXXGLResArray[num];
	var readOnly = "";
	if(flag){//可编辑,点击的是编辑
		readOnly = "";
		$("#btnTrForYPXXGL").attr("style","display:display");
		updateYpxx.obj = obj;
	}else{//不可编辑，点击的是详情
		readOnly = "readOnly";
		$("#btnTrForYPXXGL").attr("style","display:none");
	}
	$("#TYBH_YPXXGL").attr("value",obj.ypxx01000);
	$("#SBSJ_YPXXGL").attr("value",obj.ypxx01010).attr("readOnly",readOnly);
	$("#SBRY_YPXXGL").attr("value",obj.ypxx01020).attr("readOnly",readOnly);
	$("#SBDW_YPXXGL").attr("value",obj.ypxx01030).attr("readOnly",readOnly);
	$("#SBFA_YPXXGL").attr("value",obj.ypxx01040).attr("readOnly",readOnly);
	$("#SHSJ_YPXXGL").attr("value",obj.ypxx01060).attr("readOnly",readOnly);
	$("#SHRY_YPXXGL").attr("value",obj.ypxx01070).attr("readOnly",readOnly);
	$("#SHDW_YPXXGL").attr("value",obj.ypxx01080).attr("readOnly",readOnly);
	$("#SHYJ_YPXXGL").attr("value",obj.ypxx01090).attr("readOnly",readOnly);
	$("#SHZT_YPXXGL").attr("value",obj.ypxx01050=="1"?"已审核":"未审核").attr("readOnly",readOnly);
	$("#BZ_YPXXGL").attr("value",obj.ypxx01100).attr("readOnly",readOnly);
	$("#detailsDialog_ypxxgl").dialog("open");
}

function deleteYPXX(num){
	if(confirm("确定删除？")){
		var id= YPXXGLResArray[num].id;
		var data = {"id":id};
		var url = "deleteYPXXById.shtml";
		$.post(url,data, deleteYPXXResult);
	}else{
		return ;
	}
}

function deleteYPXXResult(res){
	if(res.length>4){
	 	//内容的转化（内容有标签时），防止谷歌和火狐抽风之举
		var hiddenDiv = $("<div>");
		hiddenDiv.html(res);
		res = hiddenDiv.text();
	}
	if(res=="true"){
		alert("删除成功！");
		$("#ypxxgl_tableFZJC").datagrid("reload");
	}else{
		alert("删除失败！");
	}
	$("#detailsDialog_ypxxgl").dialog("close");
}

function updateYpxx(){
	var obj = updateYpxx.obj;
	var url = "updateYpxxForYpgl.shtml";
	var dataObj = {
		"id":obj.id,
		"ypxx01000":obj.ypxx01000,
		"ypxx01010":$("#SBSJ_YPXXGL").val(),
		"ypxx01020":$("#SBRY_YPXXGL").val(),
		"ypxx01030":$("#SBDW_YPXXGL").val(),
		"ypxx01040":$("#SBFA_YPXXGL").val(),
		"ypxx01050":$("#SHZT_YPXXGL").val()=="已审核"?"1":"2",
		"ypxx01060":$("#SHSJ_YPXXGL").val(),
		"ypxx01070":$("#SHRY_YPXXGL").val(),
		"ypxx01080":$("#SHDW_YPXXGL").val(),
		"ypxx01090":$("#SHYJ_YPXXGL").val(),
		"ypxx01100":$("#BZ_YPXXGL").val(),
	}
	var data = JSON.stringify(dataObj);
	$.post(url,{"ypxx01":data},updateYpxxResult);
}

function updateYpxxResult(res){
	if(res.length>4){
	 	//内容的转化（内容有标签时），防止谷歌和火狐抽风之举
		var hiddenDiv = $("<div>");
		hiddenDiv.html(res);
		res = hiddenDiv.text();
	}
	if(res=="true"){
		alert("更新成功！");
		$("#ypxxgl_tableFZJC").datagrid("reload");
	}else{
		alert("更新失败！");
	}
	$("#detailsDialog_ypxxgl").dialog("close");
}


//研判信息审核的dategrid
function initYpxxShTable(){
	$("#ypxxsh_tableFZJC").datagrid({
		url:"",
		striped : true,
		pageSize : 10,
		height : 315,
		nowrap : false,
		columns : [[{
					field : 'ypxx01010',
					title : '上报时间',
					width : 160,
					align : 'center',
					editor : 'text'
				},{
					field : 'ypxx01020',
					title : '上报人员',
					width : 60,
					align : 'center',
					editor : 'text'
				},{
					field : 'ypxx01030',
					title : '上报单位',
					width : 120,
					align : 'center',
					editor : 'text'
				},{
					field : 'ypxx01040',
					title : '上报内容',
					width : 180,
					align : 'center',
					editor : 'text'
				},{
					field : 'oper',
					title : '操作',
					width : 120,
					align : 'center',
					formatter : function(value, rec, rowIndex) {// value id rec
						// 该对象
						//curRecObj = rec;
						YPXXSHResArray.push(rec);
						var num = YPXXSHResArray.length-1;
						var resutsHTML = "";
						var resutsHTML ="<div style='align:center;'>"
						+ "<a name='showDetails' style='padding:5px;cursor:pointer;text-decoration: underline;' onclick='upSHYJDlg(\""
						+ num
						+ "\",false)'>审核意见填写</a>"
						+"</div>";
						return resutsHTML;
					}
				}]],
		pagination : true,
		rownumbers : true,
		singleSelect : true,
	});
}

//研判信息管理的dategrid
function initYpxxGlTable(){
$("#ypxxgl_tableFZJC").datagrid({
	url:"",
	striped : true,
	pageSize : 10,
	height : 315,
	nowrap : false,
	columns : [[{
				field : 'ypxx01010',
				title : '上报时间',
				width : 180,
				align : 'center',
				editor : 'text'
			},{
				field : 'ypxx01020',
				title : '上报人员',
				width : 60,
				align : 'center',
				editor : 'text'
			},{
				field : 'ypxx01060',
				title : '审核时间',
				width : 180,
				align : 'center',
				editor : 'text'
			},{
				field : 'ypxx01070',
				title : '审核人员',
				width : 60,
				align : 'center',
				editor : 'text'
			},{
				field : 'oper',
				title : '操作',
				width : 200,
				align : 'center',
				formatter : function(value, rec, rowIndex) {// value id rec
					// 该对象
					//curRecObj = rec;
					YPXXGLResArray.push(rec);
					var num = YPXXGLResArray.length-1;
					var resutsHTML = "";
					var quedingHtml = "";
					if(rec.ypxx01110=="1"){
						quedingHtml ="<a name='Link' style='padding:5px;cursor:pointer;text-decoration: underline;' "
						+ "onclick='showJbqkInsertDlg(\"" +num + "\");'>确定</a>";
					}
					var resutsHTML =  "<div style='align:center;'>"
						+ "<a name='showDetails' style='padding:5px;cursor:pointer;text-decoration: underline;' onclick='showYPXXDetails(\""
						+ num
						+ "\",false)'>详情</a>"
						+ "<a name='addLink' style='padding:5px;cursor:pointer;text-decoration: underline;' onclick='showYPXXDetails(\""
						+ num
						+ "\",true)'>修改</a>"
						+ "<a name='saveLink' style='padding:5px;cursor:pointer;text-decoration: underline;' "
						+ "onclick='deleteYPXX(\"" +num + "\");'>删除</a>"
						+quedingHtml
						+"</div>";
					return resutsHTML;
				}
			}]],
	pagination : true,
	rownumbers : true,
	singleSelect : true,
	});
}

function showJbqkInsertDlg(num){
	insertXzdToJbqk.num = num;
	$("#jbqkInsertDiv").dialog("open");
}

function insertXzdToJbqk(){
	var num = insertXzdToJbqk.num;
	var obj = YPXXGLResArray[num];
	obj.ypxx01010 = obj.ypxx01010.replace("T"," ");
	obj.ypxx01060 = obj.ypxx01060.replace("T"," ");
	var ypxx01010Time = obj.ypxx01010.replace("T"," ");
	var url = "insertXzdToJbqk.shtml?ypxx01010Time="+ypxx01010Time;
	var data = JSON.stringify(obj);
	var dataObj = {
	jbqk0110 :$("#jbqk0110A").val(),
	jbqk0102 :$("#jbqk0102").val(),
	jbqk0120 :$("#jbqk0120").val(),
	jbqk0130 :$("#jbqk0130").val(),
	jbqk0140 :$("#jbqk0140").val(),
	jbqk0150 :$("#jbqk0150").val(),
	jbqk0160 :$("#jbqk0160").val(),
	jbqk0170 :$("#jbqk0170").val(),
	jbqk0180 :$("#jbqk0180").val(),
	jbqk0190 :$("#jbqk0190").val(),
	"ypxx01":data
	}
	$.post(url,dataObj,insertXzdToJbqkResult);
}

function insertXzdToJbqkResult(res){
	if(res.length>4){
	 	//内容的转化（内容有标签时），防止谷歌和火狐抽风之举
		var hiddenDiv = $("<div>");
		hiddenDiv.html(res);
		res = hiddenDiv.text();
	}
	if(res=="true"){
		alert("插入成功！");
		$("#jbqkInsertDiv").dialog("close");
		$("#ypxxgl_tableFZJC").datagrid("reload");
	}else{
		alert("插入失败！");
	}
}

////////////////////////////////////知识库////////////////////////////////
function initZsk_fzjcTable(){
	$("#zsk_tableFZJC").datagrid({
		url:"",
		striped : true,
		pageSize : 10,
		height : 315,
		nowrap : false,
		columns : [[ {
					field : 'zzkx01010',
					title : '名称',
					width : 150,
					align : 'center',
					editor : 'text'
				},{
					field : 'zzkx01020',
					title : '发行单位',
					width : 180,
					align : 'center',
					editor : 'text'
				},{
					field : 'zzkx01030',
					title : '发行日期',
					width : 180,
					align : 'center',
					editor : 'text'
				},{
					field : 'zzkx01060',
					title : '使用领域',
					width : 120,
					align : 'center',
					editor : 'text',
					formatter : function(value, rec, rowIndex) {// value id rec
						var resutsHTML = "";
						var syly = "政策法规";
						if(rec.zzkx01060=="2")
							syly = "工程技术"
						var resutsHTML = "<div style='align:center;'>"+
									syly+
								"</div>";
						return resutsHTML;
					}
				},{
					field : 'oper',
					title : '操作',
					width : 90,
					align : 'center',
					formatter : function(value, rec, rowIndex) {// value id rec
						// 该对象
						//curRecObj = rec;
						ZskResArray.push(rec);
						var num = ZskResArray.length-1;
						var resutsHTML = "";
						var resutsHTML = "<div style='align:center;'>"
								+ "<a name='showDetails' style='padding:5px;cursor:pointer;text-decoration: underline;' onclick='showZskDetails(\""
								+ num
								+ "\",false)'>详情</a>"
								+ "<a name='download' style='padding:5px;cursor:pointer;text-decoration: underline;' onclick='downloadZskFile(\""
								+ num
								+ "\",false)'>下载</a>"
								+"</div>";
						return resutsHTML;
					}
				}]],
		pagination : true,
		rownumbers : true,
		singleSelect : true,
	});
}

function queryZsk_Fzjc(){
	var syly = $("#zskSYLY").val();
	var startTime= $("#zskStartTime").val();
	var endTime = $("#zskEndTime").val();
	var name = $("#zskMC").val();
	var data = {
		"syly":syly,
		"startTime":startTime,
		"endTime":endTime,
		"name":name,
	}
	ZskResArray = [];
	var url = "queryZsk.shtml";
	$("#zsk_tableFZJC").datagrid({
		url : url,
		queryParams : data,
		onLoadError : function(res) {
			alert("查询失败!");
		},
		onLoadSuccess : function(res) {
		}
	});
}

function showZskDetails(num){
	var obj = ZskResArray[num];
	$("#zzkx01010").attr("value",obj.zzkx01010).attr("readOnly","readOnly");
	$("#zzkx01020").attr("value",obj.zzkx01020).attr("readOnly","readOnly");
	$("#zzkx01030").attr("value",obj.zzkx01030).attr("readOnly","readOnly");
	$("#zzkx01040").attr("value",obj.zzkx01040).attr("readOnly","readOnly");
	$("#zzkx01050").attr("value",obj.zzkx01050).attr("readOnly","readOnly");
	$("#zzkx01060").attr("value",obj.zzkx01060=="1"?"政策法规":"工程技术").attr("readOnly","readOnly");
	$("#zzkx01070").attr("value",obj.zzkx01070).attr("readOnly","readOnly");
	$("#zzkx01080").attr("value",obj.zzkx01080).attr("readOnly","readOnly");
	$("#detailsDialog_zsk").dialog("open");
}
function downloadZskFile(num){
	debugger;
	var obj = ZskResArray[num];
	var filename = obj.zzkx01070;
	window.open("../down_center.jsp?filename="+filename+"&flag=zskfile");
}
//////////////////////辅助决策方案////////////////////////////////////////////
function initFzjcfa_fzjcTable(){
	$("#fzjcfa_tableFZJC").datagrid({
		url:"",
		striped : true,
		pageSize : 10,
		height : 315,
		nowrap : false,
		columns : [[ {
					field : 'FZJC01010',
					title : '统一编号',
					width : 60,
					align : 'center',
					editor : 'text'
				},{
					field : 'FZJC01020',
					title : '上报时间',
					width : 60,
					align : 'center',
					editor : 'text'
				},{
					field : 'FZJC01030',
					title : '调查级别',
					width : 60,
					align : 'center',
					editor : 'text'
				},{
					field : 'FZJC01040',
					title : '调查单位',
					width : 60,
					align : 'center',
					editor : 'text'
				},{
					field : 'FZJC01050',
					title : '调查人员',
					width : 60,
					align : 'center',
					editor : 'text'
				},{
					field : 'FZJC01060',
					title : '监测级别',
					width : 60,
					align : 'center',
					editor : 'text'
				},{
					field : 'FZJC01070',
					title : '监测单位',
					width : 60,
					align : 'center',
					editor : 'text'
				},{
					field : 'FZJC01080',
					title : '监测人员',
					width : 60,
					align : 'center',
					editor : 'text'
				},{
					field : 'FZJC01090',
					title : '处置级别',
					width : 60,
					align : 'center',
					editor : 'text'
				},{
					field : 'FZJC01100',
					title : '处置单位',
					width : 60,
					align : 'center',
					editor : 'text'
				},{
					field : 'FZJC01110',
					title : '处置人员',
					width : 60,
					align : 'center',
					editor : 'text'
				},{
					field : 'FZJC01120',
					title : '处置方案',
					width : 60,
					align : 'center',
					editor : 'text'
				},{
					field : 'FZJC01130',
					title : '处置资源',
					width : 60,
					align : 'center',
					editor : 'text'
				},{
					field : 'FZJC01140',
					title : '参考资料',
					width : 60,
					align : 'center',
					editor : 'text'
				},{
					field : 'FZJC01150',
					title : '决策人员',
					width : 60,
					align : 'center',
					editor : 'text'
				},{
					field : 'FZJC01160',
					title : '决策单位',
					width : 60,
					align : 'center',
					editor : 'text'
				},{
					field : 'FZJC01170',
					title : '决策内容',
					width : 60,
					align : 'center',
					editor : 'text'
				},{
					field : 'FZJC01180',
					title : '决策时间',
					width : 60,
					align : 'center',
					editor : 'text'
				},{
					field : 'oper',
					title : '操作',
					width : 120,
					align : 'center',
					formatter : function(value, rec, rowIndex) {// value id rec
						// 该对象
						//curRecObj = rec;
						resArr.push(rec);
						var num = resArr.length-1;
						var resutsHTML = "";
						var resutsHTML = "<div style='align:center;'>"
								+ "<a name='showDetails' style='padding:5px;cursor:pointer;text-decoration: underline;' onclick='showDetails(\""
								+ num
								+ "\",false)'>详情</a>"
								+ "<a name='addLink' style='padding:5px;cursor:pointer;text-decoration: underline;' onclick='showDetails(\""
								+ num
								+ "\",true)'>修改</a>"
								+"</div>";
						return resutsHTML;
					}
				}]],
		pagination : true,
		rownumbers : true,
		singleSelect : true,
		onClickRow : function(rowIndex) {
		},
	});
}

function queryFzjcfa_Fzjc(){
	var shi = $("#fzjcfaShi").val();
	var xian = $("#fzjcfaXian").val();
	var cxlx = $("#fzjcfaCXLX").val();
	initFzjcfa_fzjcTable();
}
////////////////////////////////////
//点击操作栏里面的详情或者编辑，调用的方法
function showYAPPDetails(initPid,isEdit){
	var curRecObj = resYAPPArray[initPid][0];
	var jbqk01 = resYAPPArray[initPid][1];
	var isReadOnly = "readOnly";
	var isDisabled = "disabled";
	var isDisPlay = "none";
	if(isEdit){
		isReadOnly = "";
		isDisabled = "";
		isDisPlay = "";
	}
	var time = curRecObj.fzya03230==null?"":curRecObj.fzya03230;
	time=time.replace("T"," ");
	//sTime=sTime.replace("T"," ");
	//eTime=eTime.replace("T"," ");
	//$("#yjcz10000").attr("value",curRecObj.yjcz10000);
	//$("#yjcz10005").attr("value",curRecObj.yjcz10005);
	//$("input[type=radio][name=yjcz10010][value="+curRecObj.yjcz10010+"]").attr("checked","checked");
	//$("#yjcz10010").attr("value",curRecObj.yjcz10010).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	
	$("#jbqk0110").attr("value",jbqk01.jbqk0110).attr("readOnly","readOnly").attr("disabled","disabled");
	$("#fzya03000").attr("value",curRecObj.fzya03000).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	$("#fzya03160").attr("value",curRecObj.fzya03160).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	//$("#yjcz10030").attr("value",sTime).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	//$("#yjcz10040").attr("value",eTime).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	$("#fzya03170").attr("value",curRecObj.fzya03170).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	$("#fzya03180").attr("value",curRecObj.fzya03180).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	$("#fzya03190").attr("value",curRecObj.fzya03190).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	$("#fzya03200").attr("value",curRecObj.fzya03200).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	$("#fzya03210").attr("value",curRecObj.fzya03210).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	$("#fzya03220").attr("value",curRecObj.fzya03220).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	$("#fzya03230").attr("value",time).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	$("#fzya03240").attr("value",curRecObj.fzya03240).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	$("#fzya03250").attr("value",curRecObj.fzya03250).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	$("#fzya03260").attr("value",curRecObj.fzya03260).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	$("#fzya03270").attr("value",curRecObj.fzya03270).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	$("#fzya03280").attr("value",curRecObj.fzya03280).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	$("#fzya03290").attr("value",curRecObj.fzya03290).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	$("#fzya03300").attr("value",curRecObj.fzya03300).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	$("#fzya03310").attr("value",curRecObj.fzya03310).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	$("#fzya03320").attr("value",curRecObj.fzya03320).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	$("#fzya03330").attr("value",curRecObj.fzya03330).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	$("#fzya03340").attr("value",curRecObj.fzya03340).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	$("#fzya03350").attr("value",curRecObj.fzya03350).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	$("#fzya03360").attr("value",curRecObj.fzya03360).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	$("#fzya03370").attr("value",curRecObj.fzya03370).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	$("#fzya03380").attr("value",curRecObj.fzya03380).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	$("#fzya03390").attr("value",curRecObj.fzya03390).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	$("#fzya03400").attr("value",curRecObj.fzya03400).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	$("#fzya03410").attr("value",curRecObj.fzya03410).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	$("#fzya03420").attr("value",curRecObj.fzya03420).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	$("#fzya03430").attr("value",curRecObj.fzya03430).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	$("#fzya03440").attr("value",curRecObj.fzya03440).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	$("#fzya03490").attr("value",curRecObj.fzya03490).attr("readOnly",isReadOnly).attr("disabled",isDisabled);
	
	$("#submitBtn_fzya").css("display",isDisPlay);
	$("#resetBtn_fzya").css("display",isDisPlay);
	$("#detailsDialog_yaxx").dialog('open');
}

function updateFzya(){
	
	var dataObj = {
		"fzya03000":$("#fzya03000").val(),
		"fzya03160":$("#fzya03160").val(),
		"fzya03170":$("#fzya03170").val(),
		"fzya03170":$("#fzya03170").val(),
		"fzya03190":$("#fzya03190").val(),
		"fzya03200":$("#fzya03200").val(),
		"fzya03210":$("#fzya03210").val(),
		"fzya03220":$("#fzya03220").val(),
		"fzya03230":$("#fzya03230").val(),
		"fzya03240":$("#fzya03240").val(),
		"fzya03250":$("#fzya03250").val(),
		"fzya03260":$("#fzya03260").val(),
		"fzya03270":$("#fzya03270").val(),
		"fzya03280":$("#fzya03280").val(),
		"fzya03290":$("#fzya03290").val(),
		"fzya03300":$("#fzya03300").val(),
		"fzya03310":$("#fzya03310").val(),
		"fzya03320":$("#fzya03320").val(),
		"fzya03330":$("#fzya03330").val(),
		"fzya03340":$("#fzya03340").val(),
		"fzya03350":$("#fzya03350").val(),
		"fzya03360":$("#fzya03360").val(),
		"fzya03370":$("#fzya03370").val(),
		"fzya03380":$("#fzya03380").val(),
		"fzya03390":$("#fzya03390").val(),
		"fzya03400":$("#fzya03400").val(),
		"fzya03410":$("#fzya03410").val(),
		"fzya03420":$("#fzya03420").val(),
		"fzya03430":$("#fzya03430").val(),
		"fzya03440":$("#fzya03440").val(),
		"fzya03490":$("#fzya03490").val(),
	}
	
	var data = JSON.stringify(dataObj);
	//alert(data);
	
	if(isNewForFzya==1){
		url = "../../updateFzya03TempById.shtml";
		$.post(url,{"fzya03Temp":data}, updateFzyaResult);
	}else{
		var url = "../../updateFzya03ById.shtml";
		$.post(url,{"fzya03":data}, updateFzyaResult);
	}
	
}
function updateFzyaResult(res){
	if(res){
		alert("更新成功");
		$('#yapp_tableFZJC').datagrid('reload');
	}else{
		alert("更新失败");
	}
		
	$("#detailsDialog_yaxx").dialog('close');
}


//删除地图上的mark，图层等
function removeLayerAndFeatureForLogicFzjc(){
	removeLayerAndFeatureForYPXXSB();
}


//移除图层，研判信息上报的图层和mark
function removeLayerAndFeatureForYPXXSB(){
	if(ddsbmarklayer!=null){
		top.map.removeLayer(ddsbmarklayer);
		ddsbmarklayer = null;
	}
}

//隐藏图层研判信息上报的图层和mark
function hideLayerAndFeatureForYPXXSB(){
	if(ddsbmarklayer!=null){
		ddsbmarklayer.setVisibility(false);
	}
}

//显示图层，研判信息上报的图层和mark
function showLayerAndFeatureForYPXXSB(){
	if(ddsbmarklayer!=null){
		ddsbmarklayer.setVisibility(true);
	}
}
/////导出预案信息
function exportYAPPDetails(num){
	sUrl = "../../downFzyaTableByCode.shtml";
	var curRecObj = resYAPPArray[num][0];
	var code = curRecObj.fzya03000;
	$.post(sUrl,{"code":code,"qType":isNewForFzya}, exportYAPPDetailsRes);
}
function exportYAPPDetailsRes(res){
	if(res.jsonResult.indexOf("true")>-1){
		var  temp = res.jsonResult.split("$");
		var url = "../down_center.jsp?flag=fzyaFiles&filename="+temp[1];
		window.open(url);
	}else{
		alert("下载失败");
	}
}
